package campus.controller;

import campus.model.Account;
import campus.model.AccountExample;
import campus.model.AccountSettings;
import campus.service.AccountSettingsService;
import campus.util.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
     * @Author M
     * @name 银行存款控制层
     * @Date 21:38 2020/5/10
 **/
@RestController
@CrossOrigin
@RequestMapping("accountsettings")
public class AccountSettingsController {
    @Autowired
    private AccountSettingsService accountSettingsService;

    /**
         * @Author M
         * @name  银行存款列表查询
         * @Date 21:38 2020/5/10
     **/
    @RequestMapping(value = "/selectByExample",method = RequestMethod.GET)
    public List<AccountSettings> selectByExample(AccountExample example) {
        return accountSettingsService.selectByExample(null);
    }

    /**
         * @Author M
         * @name  银行存款分页
         * @Date 21:39 2020/5/10
     **/
    @RequestMapping(value = "findByAllPageSize/{pageNum}/{pageSize}",method = RequestMethod.POST)
    public PageResult findByAllPageSize(@RequestBody AccountSettings accountSettings, @PathVariable("pageNum") int pageNum , @PathVariable("pageSize") int pageSize){
        PageResult findallpage = accountSettingsService.findByAllPageSize(accountSettings,pageNum, pageSize);
        return findallpage;
    }
    @RequestMapping(value = "findByAllPageSize2/{pageNum}/{pageSize}",method = RequestMethod.POST)
    public PageResult findByAllPageSize2(@RequestBody AccountSettings accountSettings, @PathVariable("pageNum") int pageNum , @PathVariable("pageSize") int pageSize){
        PageResult findallpage = accountSettingsService.findByAllPageSize2(accountSettings,pageNum, pageSize);
        return findallpage;
    }
    /**
         * @Author M
         * @name 银行存款添加
         * @Date 21:39 2020/5/10
     **/
    @RequestMapping(value = "insert",method = RequestMethod.POST)
    public int insert(@RequestBody AccountSettings accountSettings) {
        return accountSettingsService.insert(accountSettings);
    }

   /**
        * @Author M
        * @name 银行存款主键删除
        * @Date 21:39 2020/5/10
    **/
    @RequestMapping(value = "/delete/{zhId}",method = RequestMethod.DELETE)
    public int deleteByPrimaryKey(@PathVariable(value = "zhId") Integer zhId) {
        return accountSettingsService.deleteByPrimaryKey(zhId);
    }

   /**
        * @Author M
        * @name 银行存款修改
        * @Date 21:39 2020/5/10
    **/
    @RequestMapping(value = "/accountupdate",method = RequestMethod.POST)
    public int updateByPrimaryKeySelective(@RequestBody AccountSettings record) {
        return accountSettingsService.updateByPrimaryKeySelective(record);
    }

    /**
         * @Author M
         * @name 主键ID
         * @Date 21:40 2020/5/10
     **/
    @RequestMapping(value = "/findByPrimaryKey/{zhId}",method = RequestMethod.GET)
    public AccountSettings findByPrimaryKey(@PathVariable(value = "zhId") Integer zhId) {
        return accountSettingsService.findByPrimaryKey(zhId);
    }
}
